home *** CD-ROM | disk | FTP | other *** search
- Path: news.halcyon.com!usenet
- From: normanb@halcyon.com (Norm Bryar)
- Newsgroups: comp.lang.c++
- Subject: Re: Random dice program problem need help!!!!!
- Date: Thu, 15 Feb 1996 16:51:04 GMT
- Organization: Northwest Nexus Inc.
- Message-ID: <4fvo8n$jed@news.halcyon.com>
- References: <4fqum6$pbj@news.bellglobal.com>
- NNTP-Posting-Host: blv-pm10-ip5.halcyon.com
- X-Newsreader: Forte Free Agent 1.0.82
-
- rchartra@feldspar.com (Ron Chartrand) wrote:
-
- >I am using Borland C 4.52 i have been trying to make a callable
- >routine to simulate rolling 3 six sided dice but it always comes out
- >to be the same number?? need help!!!!!
-
- >//3d6 dice roll
- >void Threed6()
- >{
- >randomize();
- >dice1=0;
- >dice2=0;
- >dice3=0;
-
- >dice1=rand()%6+1;
- >dice2=rand()%6+1;
- >dice3=rand()%6+1;
- >Total=dice1+dice2+dice3;
- >}
-
- >just Email me at rchartra@feldspar.com
-
- I'm not a Borland officianado, but one usually seeds the random number
- generator with some "random" value at the beginning, say, of program
- execution. Usually one uses the time for the seed.
-
- srand( (unsigned)time( NULL ) ); in MSVC
-
- Does Borland's randomize() not accept a parameter for the seed value?
-
-
- --Norm
-
-
-
-